﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="common/taglibs.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
    	<title>Job列表</title>
<jsp:include page="common/header.jsp"/>
	</head>
	<body>
<jsp:include page="common/body-header.jsp"/>
		<b>Running Jobs</b>
		<table>
			<tr>
				<th>JobId</th>
				<th>Type</th>
				<th>Name</th>
				<th>Submitter</th>
				<th>SubmitTime</th>
				<th>LaunchTime</th>
				<th>WaitTime</th>
				<th>RunTime</th>
				<th>TotalTime</th>
				<th>Status</th>
				<th>Action</th>
			</tr>
			<c:forEach var="job" items="${jobs}"><c:if test="${job.status=='run'}">
			<tr>
				<td><a href="job-result.action?identifier=${job.identifier.stringIdentifier}">${job.identifier.stringIdentifier}</a></td>
				<td>${job.type}</td>
				<td><a href="job-conf.action?action=view&identifier=${job.jobConfIdentifier.stringIdentifier}">${ss:getJobConf(jobConfController, job.jobConfIdentifier).name}</a></td>
				<td>${job.submitter}</td>
				<td>${ss:dateFormat(job.submitTime)}</td>
				<td>${ss:dateFormat(job.launchTime)}</td>
				<td>${ss:timeBetween(job.launchTime, job.submitTime)}</td>
				<td>${ss:fromNowOn(job.launchTime)}</td>
				<td>${ss:fromNowOn(job.submitTime)}</td>
				<td>${job.status}</td>
				<td><a href="job-change.action?change=kill&identifier=${job.identifier.stringIdentifier}"><img alt="kill" src="images/icons/kill.jpg" title="kill"></a></td>
			</tr>
			</c:if></c:forEach>
		</table><br>
		<b>Queuing Jobs</b>
		<table>
			<tr>
				<th>JobId</th>
				<th>Type</th>
				<th>Name</th>
				<th>Submitter</th>
				<th>SubmitTime</th>
				<th>WaitTime</th>
				<th>Action</th>
			</tr>
			<c:forEach var="job" items="${jobs}" ><c:if test="${job.status=='queue'}">
			<tr>
				<td><a href="job-result.action?identifier=${job.identifier.stringIdentifier}">${job.identifier.stringIdentifier}</a></td>
				<td>${job.type}</td>
				<td><a href="job-conf.action?action=view&identifier=${job.jobConfIdentifier.stringIdentifier}">${ss:getJobConf(jobConfController, job.jobConfIdentifier).name}</a></td>
				<td>${job.submitter}</td>
				<td>${ss:dateFormat(job.submitTime)}</td>
				<td>${ss:fromNowOn(job.submitTime)}</td>
				<td>
					<a href="job-change.action?change=pause&identifier=${job.identifier.stringIdentifier}"><img alt="pause" src="images/icons/pause.jpg" title="pause"></a>
					<a href="job-change.action?change=cancel&identifier=${job.identifier.stringIdentifier}"><img alt="cancel" src="images/icons/stop.jpg" title="cancel"></a>
				</td>
			</tr>
			</c:if></c:forEach>
		</table><br>
		<b>Readying Jobs</b>
		<table>
			<tr>
				<th>JobId</th>
				<th>Type</th>
				<th>Name</th>
				<th>Submitter</th>
				<th>SubmitTime</th>
				<th>WaitTime</th>
				<th>Action</th>
			</tr>
			<c:forEach var="job" items="${readyJobs}" >
			<tr>
				<td><a href="job-result.action?identifier=${job.identifier.stringIdentifier}">${job.identifier.stringIdentifier}</a></td>
				<td>${job.type}</td>
				<td><a href="job-conf.action?action=view&identifier=${job.jobConfIdentifier.stringIdentifier}">${ss:getJobConf(jobConfController, job.jobConfIdentifier).name}</a></td>
				<td>${job.submitter}</td>
				<td>${ss:dateFormat(job.submitTime)}</td>
				<td>${ss:fromNowOn(job.submitTime)}</td>
				<td>
					<a href="job-change.action?change=pause&identifier=${job.identifier.stringIdentifier}"><img alt="pause" src="images/icons/pause.jpg" title="pause"></a>
					<a href="job-change.action?change=cancel&identifier=${job.identifier.stringIdentifier}"><img alt="cancel" src="images/icons/stop.jpg" title="cancel"></a>
				</td>
			</tr>
			</c:forEach>
		</table><br>
		<b>Pausing Jobs</b>
		<table>
			<tr>
				<th>JobId</th>
				<th>Type</th>
				<th>Name</th>
				<th>Submitter</th>
				<th>SubmitTime</th>
				<th>WaitTime</th>
				<th>Action</th>
			</tr>
			<c:forEach var="job" items="${jobs}" ><c:if test="${job.status=='pause'}">
			<tr>
				<td><a href="job-result.action?identifier=${job.identifier.stringIdentifier}">${job.identifier.stringIdentifier}</a></td>
				<td>${job.type}</td>
				<td><a href="job-conf.action?action=view&identifier=${job.jobConfIdentifier.stringIdentifier}">${ss:getJobConf(jobConfController, job.jobConfIdentifier).name}</a></td>
				<td>${job.submitter}</td>
				<td>${ss:dateFormat(job.submitTime)}</td>
				<td>${ss:fromNowOn(job.submitTime)}</td>
				<td>
					<a href="job-change.action?change=resume&identifier=${job.identifier.stringIdentifier}"><img alt="resume" src="images/icons/play.png" title="resume"></a>
				</td>
			</tr>
			</c:if></c:forEach>
		</table><br>
		<b>Waiting Jobs: init, submit</b>
		<table>
			<tr>
				<th>JobId</th>
				<th>Type</th>
				<th>Name</th>
				<th>Submitter</th>
				<th>SubmitTime</th>
				<th>WaitTime</th>
				<th>Ready</th>
				<th>Status</th>
				<th>Action</th>
			</tr>
			<c:forEach var="job" items="${jobs}" ><c:if test="${job.status=='init' || job.status=='submit'}">
			<tr>
				<td><a href="job-result.action?identifier=${job.identifier.stringIdentifier}">${job.identifier.stringIdentifier}</a></td>
				<td>${job.type}</td>
				<td><a href="job-conf.action?action=view&identifier=${job.jobConfIdentifier.stringIdentifier}">${ss:getJobConf(jobConfController, job.jobConfIdentifier).name}</a></td>
				<td>${job.submitter}</td>
				<td>${ss:dateFormat(job.submitTime)}</td>
				<td>${ss:fromNowOn(job.submitTime)}</td>
				<td>${job.ready}</td>
				<td>${job.status}</td>
				<td>
					<a href="job-change.action?change=cancel&identifier=${job.identifier.stringIdentifier}"><img alt="cancel" src="images/icons/stop.jpg" title="cancel"></a>
				</td>
			</tr>
			</c:if></c:forEach>
		</table><br>
		<b>Failed Jobs</b>
		<table>
			<tr>
				<th>JobId</th>
				<th>Type</th>
				<th>Name</th>
				<th>Submitter</th>
				<th>SubmitTime</th>
				<th>LaunchTime</th>
				<th>FinishTime</th>
				<th>WaitTime</th>
				<th>RunTime</th>
				<th>TotalTime</th>
				<th>Status</th>
			</tr>
			<c:forEach var="job" items="${jobs}" ><c:if test="${ss:isFinished(job.status) && !job.succeed}">
			<tr>
				<td><a href="job-result.action?identifier=${job.identifier.stringIdentifier}">${job.identifier.stringIdentifier}</a></td>
				<td>${job.type}</td>
				<td><a href="job-conf.action?action=view&identifier=${job.jobConfIdentifier.stringIdentifier}">${ss:getJobConf(jobConfController, job.jobConfIdentifier).name}</a></td>
				<td>${job.submitter}</td>
				<td>${ss:dateFormat(job.submitTime)}</td>
				<td>${ss:dateFormat(job.launchTime)}</td>
				<td>${ss:dateFormat(job.finishTime)}</td>
				<td>${ss:timeBetween(job.launchTime, job.submitTime)}</td>
				<td>${ss:timeBetween(job.finishTime, job.launchTime)}</td>
				<td>${ss:timeBetween(job.finishTime, job.submitTime)}</td>
				<td>${job.status}</td>
			</tr>
			</c:if></c:forEach>
		</table><br>
		<b>Retry Jobs</b>
		<table>
			<tr>
				<th>JobId</th>
				<th>Type</th>
				<th>Name</th>
				<th>Submitter</th>
				<th>SubmitTime</th>
				<th>LaunchTime</th>
				<th>FinishTime</th>
				<th>WaitTime</th>
				<th>RunTime</th>
				<th>TotalTime</th>
				<th>Retry</th>
			</tr>
			<c:forEach var="job" items="${jobs}" ><c:if test="${job.status=='retry'}">
			<tr>
				<td><a href="job-result.action?identifier=${job.identifier.stringIdentifier}">${job.identifier.stringIdentifier}</a></td>
				<td>${job.type}</td>
				<td><a href="job-conf.action?action=view&identifier=${job.jobConfIdentifier.stringIdentifier}">${ss:getJobConf(jobConfController, job.jobConfIdentifier).name}</a></td>
				<td>${job.submitter}</td>
				<td>${ss:dateFormat(job.submitTime)}</td>
				<td>${ss:dateFormat(job.launchTime)}</td>
				<td>${ss:dateFormat(job.finishTime)}</td>
				<td>${ss:timeBetween(job.launchTime, job.submitTime)}</td>
				<td>${ss:timeBetween(job.finishTime, job.launchTime)}</td>
				<td>${ss:timeBetween(job.finishTime, job.submitTime)}</td>
				<td>${job.retry} of ${job.maxRetry}</td>
			</tr>
			</c:if></c:forEach>
		</table><br>
		<b>Completed Jobs</b>
		<table>
			<tr>
				<th>JobId</th>
				<th>Type</th>
				<th>Name</th>
				<th>Submitter</th>
				<th>SubmitTime</th>
				<th>LaunchTime</th>
				<th>FinishTime</th>
				<th>WaitTime</th>
				<th>RunTime</th>
				<th>TotalTime</th>
			</tr>
			<c:forEach var="job" items="${finishJobs}" ><c:if test="${job.status=='finish' && job.succeed}">
			<tr>
				<td><a href="job-result.action?identifier=${job.identifier.stringIdentifier}">${job.identifier.stringIdentifier}</a></td>
				<td>${job.type}</td>
				<td><a href="job-conf.action?action=view&identifier=${job.jobConfIdentifier.stringIdentifier}">${ss:getJobConf(jobConfController, job.jobConfIdentifier).name}</a></td>
				<td>${job.submitter}</td>
				<td>${ss:dateFormat(job.submitTime)}</td>
				<td>${ss:dateFormat(job.launchTime)}</td>
				<td>${ss:dateFormat(job.finishTime)}</td>
				<td>${ss:timeBetween(job.launchTime, job.submitTime)}</td>
				<td>${ss:timeBetween(job.finishTime, job.launchTime)}</td>
				<td>${ss:timeBetween(job.finishTime, job.submitTime)}</td>
			</tr>
			</c:if></c:forEach>
		</table>
<jsp:include page="common/body-footer.jsp"/>
	</body>
</html>
